package com.iamteer.a_lifecycle;

import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;

/**
 * 监听 request 对象的创建或销毁
 * @author Chuck
 *
 */

public class MyRequestListener  implements ServletRequestListener{

	@Override
	public void requestDestroyed(ServletRequestEvent arg0) {
		Object obj = arg0.getServletRequest().getAttribute("cn");
		if (obj != null) {
			System.out.println(obj.toString());
		}
		System.out.println("requestDestroyed");
	}

	@Override
	public void requestInitialized(ServletRequestEvent arg0) {
		// TODO Auto-generated method stub
		System.out.println("requestInitialized");
	}

}
